﻿@using EcBlog.Models
@model DynamicPagesViewModel
@{
   Layout = Model.Layout.LayoutPath;
}

@if (!string.IsNullOrEmpty(Model.FilterDescription))
{
   <h4>@Model.FilterDescription</h4>
}

<ol>
@if (Model.Pages != null && Model.Pages.Count > 0)
{
   foreach (var page in Model.Pages)
   {
       <li>
       <article >
           @Html.Partial("_PostHeader", new PostHeaderViewModel { Page = page})
           @Html.Raw(page.ContentHtml)
           @Html.Partial("_PostFooter", new PostFooterViewModel { Page = page, ShowComments =false, ShowAddNewCommentPanel= false })
       </article>  
       </li>
   }
}
</ol>

<div id="pagenavigation" >
@if (Model.ShowPrevious)
{
   <a href="/@Model.Paging/@(Model.CurrentPage-1)"><<
   </a>
}
@for (int i = 1; i < Model.TotalPage +1; i++)
{
   if(i != Model.CurrentPage)
   {
       <a href="/@Model.Paging/@i">@i
       </a>
   }
   else
   {
       @i
   }
}
@if (Model.ShowNext)
{
   <a href="/@Model.Paging/@(Model.CurrentPage+1)">>>
   </a>
}
</div>

   
@section nav{
   @Html.Partial("_Navigation")
}
@section header{
   @Html.Partial("_Header")
}
@section extra{
   @Html.Partial("_Extra")
}
@section footer{
   @Html.Partial("_Footer")
}    
@section head{
   @Html.Partial("_Head")
}